In [ ]:
#!/user/bin/env/ python3
print("Welcome to the Dictionary Writer")
print("Here you will enter a term and defintion")
print("and it will be saved to a properly formatted")
print("text file, for later recovery and study")
def exitRoutine():
print("Do you want to enter another?")
exitAnswer = input("Y or N ==>")
if exitAnswer == "Y" or exitAnswer == "y":
termAdd()
elif exitAnswer == "n" or exitAnswer == "N":
print("Have a nice day!!! :-)")
else:
exitRoutine()
def termAdd():
########################VARIABLES################
dictionaryFile = open("My_Dictionary.txt", "+a")#Here I open my dictionary file
newLine = "\n"#This will create a new line in my text file
space = " - "#This will act as a space between my terms, and definition
######################INPUT SECTION#######################
myTerm = input("What is the item you are defining? ==> ")#Input for the term
myDefinition = input("What is the definition of the term ==> ")#Here is the definition
finalTerm = myTerm + space + myDefinition + newLine
dictionaryFile.write(finalTerm)
dictionaryFile.close()
print(finalTerm)
print("I have finished")
exitRoutine()
termAdd()
Welcome to the Dictionary Writer Here you will enter a term and defintion and it will be saved to a properly formatted text file, for later recovery and study
In [ ]:
In [ ]: